﻿using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using XQ.RequestOfficeSupplies.BLL.Export;
using XQ.RequestOfficeSupplies.DAL.DAL.Common;
using XQ.RequestOfficeSupplies.DAL.Model;
using XQ.RequestOfficeSupplies.DAL.Model.Business;
using XQ.RequestOfficeSupplies.DAL.Models;
using XQ.RequestOfficeSupplies.WebAPI.Common;
using XQ.RequestOfficeSupplies.WebAPI.Filter;
using XQ.RequestOfficeSupplies.WebAPI.Models;

namespace XQ.RequestOfficeSupplies.WebAPI.Controllers.Export
{
    [FormAuthenticationFilter]
    public class ExportController : ApiController
    {
        ExportBLL exportBLL = new ExportBLL();
        ///// <summary>
        ///// 导出水费账单
        ///// </summary>
        ///// <param name="ssm"></param>
        ///// <returns></returns>
        //[Route("api/Export/ExportWaterBill")]
        //[HttpGet]
        //public ResultModel ExportWaterBill([FromUri] WaterBillSearchModel ssm)
        //{
        //    ResultModel resultModel = new ResultModel();
        //    try
        //    {
        //        TokenModel token = TokenHelper.GetTokenByHeaders(Request.Headers);
        //        Pagination page = new Pagination();
        //        LogBll.Instance.WriteLog(LogBll.LogType.Excel, "", token.UID, "导出水费账单", "", "", "", "api/Export/ExportWaterBill:" + JsonConvert.SerializeObject(ssm));
        //        resultModel.data = exportBLL.ExportWaterBill(ssm, page, token);
        //    }
        //    catch (Exception ex)
        //    {
        //        LogBll.Instance.WriteErrLog("", 0, "导出水费账单报错", "", "", "", ex.StackTrace, "", "ExportController", "ExportWaterBill");
        //        resultModel.success = false;
        //        resultModel.message = ex.StackTrace;
        //        resultModel.code = "10001";
        //    }

        //    return resultModel;

        //}
        ///// <summary>
        ///// 导出电费账单
        ///// </summary>
        ///// <param name="ssm"></param>
        ///// <returns></returns>
        //[Route("api/Export/ExportElectricityBill")]
        //[HttpGet]
        //public ResultModel ExportElectricityBill([FromUri] ElectricityBillSearchModel ssm)
        //{
        //    ResultModel resultModel = new ResultModel();
        //    try
        //    {
        //        TokenModel token = TokenHelper.GetTokenByHeaders(Request.Headers);
        //        Pagination page = new Pagination();
        //        LogBll.Instance.WriteLog(LogBll.LogType.Excel, "", token.UID, "导出电费账单", "", "", "", "api/Export/ExportElectricityBill:" + JsonConvert.SerializeObject(ssm));
        //        resultModel.data = exportBLL.ExportElectricityBill(ssm, page, token);
        //    }
        //    catch (Exception ex)
        //    {
        //        LogBll.Instance.WriteErrLog("", 0, "导出电费账单报错", "", "", "", ex.StackTrace, "", "ExportController", "ExportElectricityBill");
        //        resultModel.success = false;
        //        resultModel.message = ex.StackTrace;
        //        resultModel.code = "10001";
        //    }

        //    return resultModel;

        //}

        ///// <summary>
        ///// 导出房租账单
        ///// </summary>
        ///// <param name="ssm"></param>
        ///// <returns></returns>
        //[Route("api/Export/ExportRentBill")]
        //[HttpGet]
        //public ResultModel ExportRentBill([FromUri] RentBillSearchModel ssm)
        //{
        //    ResultModel resultModel = new ResultModel();
        //    try
        //    {
        //        TokenModel token = TokenHelper.GetTokenByHeaders(Request.Headers);
        //        Pagination page = new Pagination();
        //        LogBll.Instance.WriteLog(LogBll.LogType.Excel, "", token.UID, "导出房租账单", "", "", "", "api/Export/ExportRentBill:" + JsonConvert.SerializeObject(ssm));
        //        resultModel.data = exportBLL.ExportRentBill(ssm, page, token);
        //    }
        //    catch (Exception ex)
        //    {
        //        LogBll.Instance.WriteErrLog("", 0, "导出房租账单报错", "", "", "", ex.StackTrace, "", "ExportController", "ExportRentBill");
        //        resultModel.success = false;
        //        resultModel.message = ex.StackTrace;
        //        resultModel.code = "10001";
        //    }

        //    return resultModel;

        //}
    }
}